package io.gbznt.modules.buss.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import freemarker.template.utility.StringUtil;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import io.gbznt.common.utils.PageUtils;
import io.gbznt.common.utils.Query;

import io.gbznt.modules.buss.dao.BussWeatherRecordDao;
import io.gbznt.modules.buss.entity.BussWeatherRecordEntity;
import io.gbznt.modules.buss.service.BussWeatherRecordService;


@Service("bussWeatherRecordService")
public class BussWeatherRecordServiceImpl extends ServiceImpl<BussWeatherRecordDao, BussWeatherRecordEntity> implements BussWeatherRecordService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
    	String dq = (String) params.get("area");
        IPage<BussWeatherRecordEntity> page = this.page(
                new Query<BussWeatherRecordEntity>().getPage(params),
                new QueryWrapper<BussWeatherRecordEntity>()
                .like(StringUtils.isNotBlank(dq), "area", dq)
                .orderByDesc("create_time")
        );

        return new PageUtils(page);
    }

}
